binutils, the GNU binary utilities

Contents|Index|Previous|Next
`binutils`, the GNU binary utilities

The following are the binary utilities, although they are not included on all hosts: ar, nm, objcopy, objdump, ranlib, readelf, size, strings, and strip. There are three binary utilities that are for use with Cygwin, the porting layer application for Win32 development: addr2line, windres, and dlltool.

For more information on binutils, see Using `binutils` in GNUPro Utilities.

The most important of these utilities are objcopy and objdump.

objcopy

A few ROM monitors, such as a.out, load executable binary images, and, consequently, most load an S-record. An S-record is a printable ASCII representation of an executable binary image.

S-records are suitable both for building ROM images for standalone boards and for downloading images to embedded systems. Use the following example’s input for this process.

    objcopy -O srec infile outfile

infile in the previous example’s input is the executable binary filename, and outfile is the filename for the S-record.

Most PROM burners also read S-records or some similar format. Use the following example’s input to get a list of supported object file types for your architecture.

    objdump -i

For more information on S-records, see the discussions for FORMAT output-format in MRI compatible script files and the general discussion of BFD in Using `ld` in GNUPro Utilities. For more discussion of making an executable binary image, see objcopy in Using `binutils` in GNUPro Utilities.

objdump

objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work.

When specifying archives, objdump shows information on each of the member object files. objfile... are the object files to be examined. See objdump utility in Using `binutils` in GNUPro Utilities.

A few of the more useful options for commands are: -d, -disassemble and -prefix-addresses.

-d
--disassemble

Displays the aseembler mnemonics for the machine instructions from objfile. Only disassembles those sections that are expected to contain instructions.

--prefix-addresses

For disassembling, prints the complete address on each line, starting each output line with the address it’s disassembling. This is the older disassembly format. Otherwise, you only get raw opcodes.

Top|Contents|Index|Previous|Next